package com.das.mechanic_base.adapter.main;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.das.mechanic_base.R;

import java.util.ArrayList;
import java.util.List;

public class X3RecongitionWarnPhotoAdapter extends RecyclerView.Adapter<X3RecongitionWarnPhotoAdapter.RecongitionWarnPhotoHolder> {

    private Context mContext;

    private List<String> mList;
    public X3RecongitionWarnPhotoAdapter(Context mContext) {
        this.mContext = mContext;
        this.mList = new ArrayList<>();
    }

    public void setList(List<String> mList) {
        this.mList.clear();
        this.mList.addAll(mList);
        notifyDataSetChanged();
    }

    @NonNull
    @Override
    public X3RecongitionWarnPhotoAdapter.RecongitionWarnPhotoHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        return new RecongitionWarnPhotoHolder(LayoutInflater.from(mContext).inflate(R.layout.x3_main_recognition_photo_item,parent,false));
    }

    @Override
    public void onBindViewHolder(@NonNull X3RecongitionWarnPhotoAdapter.RecongitionWarnPhotoHolder holder, int position) {
//        if(mList.get(position).equals("1")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_doorswindowsnotclosed);
//        } else if(mList.get(position).equals("2")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_notwearing );
//        }else if(mList.get(position).equals("3")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_frosttips );
//        }else if(mList.get(position).equals("4")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_cruisecontrol );
//        }else if(mList.get(position).equals("5")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_foglightson );
//        }else if(mList.get(position).equals("6")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_highbeamon );
//        }else if(mList.get(position).equals("7")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_rampassist );
//        }else if(mList.get(position).equals("8")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_glassheating );
//        }else if(mList.get(position).equals("9")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_brakeindicator );
//        }else if(mList.get(position).equals("10")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_fuelshortage );
//        }else if(mList.get(position).equals("11")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_lowtirepressure );
//        }else if(mList.get(position).equals("12")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_insufficientcleaningfluid );
//        }else if(mList.get(position).equals("13")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_batterydisadvantages );
//        }else if(mList.get(position).equals("14")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_needmaintenance );
//        }else if(mList.get(position).equals("15")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_abnormalwatertemperature );
//        }else if(mList.get(position).equals("16")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_oilalarmlamp );
//        }else if(mList.get(position).equals("17")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_insufficientcoolant );
//        }else if(mList.get(position).equals("18")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_brakediscwear );
//        }else if(mList.get(position).equals("19")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_safetyairbag );
//        }else if(mList.get(position).equals("20")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_enginefailure );
//        }else if(mList.get(position).equals("21")){
//            holder.iv_photo.setImageResource(R.mipmap.x3_others );
//        }



    }



    @Override
    public int getItemCount() {
        return mList.size();
    }

    class RecongitionWarnPhotoHolder extends RecyclerView.ViewHolder {
        ImageView iv_photo;
        public RecongitionWarnPhotoHolder(@NonNull View itemView) {
            super(itemView);
            iv_photo=itemView.findViewById(R.id.iv_photo);

        }
    }
}
